package com.itheima.model.vo;

import com.itheima.model.domain.UserInfo;
import com.itheima.model.mongo.Movement;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class MovementsHVo implements Serializable {

    private Integer commentCount = 0;
    private Long createDate;
    private Integer forwardingCount = 0;
    private String id;
    private Integer likeCount = 0;
    private List<String> medias;
    private String nickname;
    private Integer reportCount = 0;
    //1为待审核，2为自动审核通过，3为待人工审核，4为人工审核拒绝，5为人工审核通过，6为自动审核拒绝
    private String state;
    private String text;
    private Integer topState = 1;  //置顶 默认 1
    private Long userId;
    private String userLogo;   //头像

    public static MovementsHVo init(UserInfo userInfo, Movement item) {
        MovementsHVo vo = new MovementsHVo();
        vo.setCreateDate(item.getCreated());
        vo.setId(item.getPid().toString());
        vo.setMedias(item.getMedias());
        vo.setNickname(userInfo.getNickname());
        vo.setState(item.getState().toString());
        vo.setText(item.getTextContent());
        vo.setUserId(item.getUserId());
        vo.setUserLogo(userInfo.getCoverPic());
        return vo;
    }


}
